package com.ayoka.parenting.adapter;

import com.ayoka.parenting.Constants;
import com.ayoka.parenting.R;
import com.ayoka.parenting.bean.ClassroomBean;
import com.jincp.common.brvah.BaseQuickAdapter;
import com.jincp.common.brvah.BaseViewHolder;
import com.jincp.common.utils.DateUtil;
import com.jincp.common.utils.StringUtil;

/**
 * Created by jinchunping on 2018/4/11.
 */

public class GrownIndexClassroomAdapter extends BaseQuickAdapter<ClassroomBean, BaseViewHolder> {

    public GrownIndexClassroomAdapter() {
        super(R.layout.item_grown_index_classroom);
    }

    @Override
    protected void convert(BaseViewHolder holder, final ClassroomBean item) {
        holder.setText(R.id.tv_classroom_name, item.Title)
                .setText(R.id.tv_start_date, StringUtil.formatString(R.string.format_start_date, DateUtil.get10Date(item.StartDate)))
                .setText(R.id.tv_start_time, StringUtil.formatString(R.string.format_start_time, StringUtil.formatString("%02d:%02d", item.Hour, item.Min)))
                .setText(R.id.tv_start_node, StringUtil.formatString(R.string.format_start_node, item.getStartNode()))
                .setText(R.id.tv_join_count, StringUtil.formatString(R.string.format_join_grown_count, item.MemberCount))
        .setVisible(R.id.tv_test_course, item.IsOnTrial == Constants.ClassroomType.TEST)
                .setVisible(R.id.tv_grown_course, item.IsOnTrial == Constants.ClassroomType.GROW);
    }
}